#include <stdio.h>
#include <tchar.h>

#include <iostream>

#include <windows.h>

#include <WinNT.h>

#include "Interface.h"

int _tmain(int argc, _TCHAR* argv[])
{
    UNREFERENCED_PARAMETER(argc);
    UNREFERENCED_PARAMETER(argv);
  
    HANDLE hFilterDevice = CreateFileW(FileHidingFilterCDONameForUser,
                                       GENERIC_READ | GENERIC_WRITE,
                                       0,
                                       NULL,
                                       OPEN_EXISTING,
                                       FILE_ATTRIBUTE_NORMAL,
                                       NULL);

    if (INVALID_HANDLE_VALUE == hFilterDevice)
    {
        return EXIT_FAILURE;
    }

    DWORD dwBytesReturned = 0;

    if (!DeviceIoControl(hFilterDevice,
                         IOCTL_FHF_RELOAD_RULES,
                         NULL,
                         0,
                         NULL,
                         0,
                         &dwBytesReturned,
                         NULL))
    {
        CloseHandle(hFilterDevice);

        return EXIT_FAILURE;
    }

    CloseHandle(hFilterDevice);

	return EXIT_SUCCESS;
}

